-
Notifications
You must be signed in to change notification settings - Fork 7.3k
fix(app): support anthropic models on azure cognitive services #9000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
fix(app): support anthropic models on azure cognitive services #9000
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
The PR #8566 could be worth reviewing to ensure there's no overlap with your current fix. The other results returned were the current PR itself (#9000) or unrelated feature PRs. |
|
/review |
|
lgtm |
a6e242d to
d1f8fc0
Compare
|
are we good here? @rekram1-node |
|
I actually have a simpler solution if u wanna test it |
|
@uanandaraja try this? |
it says RESOURCE NOT FOUND, different env variable?
|
|
Hm may need a tweak but do you see what I'm trying to do? everything should live in that one module it shouldnt require edits outside of it |
| }, | ||
| ) | ||
|
|
||
| // Azure Cognitive Services with Claude models uses Anthropic SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change shouldnt be needed
|
|
||
| export function providerOptions(model: Provider.Model, options: { [x: string]: any }) { | ||
| // Azure Cognitive Services with Claude models uses Anthropic provider options | ||
| const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change shouldnt be needed
| // Anthropic rejects messages with empty content - filter out empty string messages | ||
| // and remove empty text/reasoning parts from array content | ||
| if (model.api.npm === "@ai-sdk/anthropic") { | ||
| const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldnt be needed
| if (id.includes("deepseek") || id.includes("minimax") || id.includes("glm") || id.includes("mistral")) return {} | ||
|
|
||
| // Azure Cognitive Services with Claude models uses Anthropic thinking config | ||
| const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think this should be needed
| // Special case: google-vertex-anthropic uses a subpath import | ||
| const bundledKey = | ||
| model.providerID === "google-vertex-anthropic" ? "@ai-sdk/google-vertex/anthropic" : model.api.npm | ||
| model.providerID === "google-vertex-anthropic" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldnt be needed
| } | ||
|
|
||
| // Special case: Azure Cognitive Services with Anthropic models uses @ai-sdk/anthropic | ||
| const isAzureClaude = model.providerID === "azure-cognitive-services" && model.api.id.includes("claude") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you would also need to handle if the resourceName is being passed as a provider option for the provider

When using Anthropic models (like claude-opus-4.5) via Azure Cognitive Services, the code was using
@ai-sdk/azureSDK which tries to callsdk.responses(modelID). But@ai-sdk/azuredoesn't support Anthropic models - Azure's Anthropic endpoint uses a different API structure that requires@ai-sdk/anthropic.